package com.googlecode.garbagecan.jmsstudy.activemq.spring2;

import java.util.ArrayList;
import java.util.List;

public class RegistrationServiceImpl implements RegistrationService {

	List<String> list;

	public RegistrationServiceImpl() {
		list = new ArrayList<String>();
		list.add("kongxx");
		list.add("mandy");
	}

	public RegistrationReply processRequest(RegistrationRequest request) {
		System.out.println("Register for " + request.getName());

		try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

		if (list.contains(request.getName())) {
			return new RegistrationReply(request.getName(), true);
		} else {
			return new RegistrationReply(request.getName(), false);
		}
	}

}
